<%--
  Created by IntelliJ IDEA.
  User: 俊杰
  Date: 4/11/2022
  Time: 7:06 PM
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<%@ include file="/WEB-INF/include-head.jsp" %>
<script>
    $(function(){
        console.log("ajax函数之前")

        $("#asyncBtn").click(function(){
            $.ajax({
                async: false,       //关闭异步工作模式，使用同步方式工作，此时所有操作在同一个线程内按顺序执行
                url: "test/async/ajax.html",
                type: "post",
                dataType: "text",
                success: function (response){
                    console.log("ajax函数的内部success函数:"+response)
                }
            })

            console.log("ajax函数之后")

        })
    })
</script>
<body>
<%@ include file="/WEB-INF/include-nav.jsp" %>

<div class="container-fluid">
    <div class="row">
        <%@ include file="/WEB-INF/include-sidebar.jsp" %>

        <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
            <button id="asyncBtn">发送Ajax请求</button>


        </div>
    </div>
</div>

</body>
</html>
